import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
import { viteMockServe } from "vite-plugin-mock";
import tailwindcss from '@tailwindcss/vite'

// https://vite.dev/config/
export default defineConfig({
  server: {
    proxy: {
      // 将以 /api 开头的请求代理到 http://localhost:3000
      "/api": {
        target: "http://127.0.0.1:7001",
        changeOrigin: true,
      },
    },
  },
  resolve: {
    alias: {
      "@lgq": path.resolve(__dirname, "./src"),
    },
  },
  plugins: [
    react(),
    tailwindcss(),
    viteMockServe({
      mockPath: "mock", // 指定Mock数据文件夹路径
      enable: true, // 启用Mock功能
      logger: true, // 控制台打印请求日志
    }),
  ],
});
